This invention relates to generating digitally controlled voltage levels and, in particular, to generating width-modulated pulses for obtaining finely controlled voltage levels after low-pass filtering
Dynamically-controlled-level direct voltage, or direct current (DC), is required in a wide range of apparatus types, for a great variety of applications and using various technologies. These include, notably, speed control of DC motors, and analog control of the radiation levels of various devices. A common method for generating a direct voltage with dynamically controlled level, using digital circuitry, is Pulse Width Modulation (PWM). This method is considerably less expensive and more power efficient than utilizing analog circuitry, such as digital-to analog converters, especially when high-resolution control is desired. A typical PWM implementation, providing control by a number, n bits long and thus providing voltage level resolution of N=2{circumflex over ( )}n (2 to the power of n) steps, comprises an n-bit counter, an n-bit comparator, and a flip-flop, as shown in FIG. 1. The counter is fed by a train of clock pulses and whenever it wraps to 0 (i.e. resets itself after reaching maximum count), the flip-flop is set to 1, and when the counter matches the value V of the control number, corresponding to the desired voltage level, the flip-flop is reset to 0. The resulting output waveform is a train of rectangular pulses, whose rate (or frequency), R, is equal, to the clock frequency, C, divided by N and whose controllable pulse width is V clock periods, the average voltage thus equaling the desired output level. FIG. 5A shows an example of a waveform for V=17, output from such a prior-art system with n=6 (N=64). The horizontal axis represents time; the units are pulse periods, each being in this case 2{circumflex over ( )}6=64 clock periods long. It is noted that the value of 6 for n in this and subsequent examples has been chosen for clarity of illustration and that in practice the value of n is much higher, typically around 14.
If a smooth analog output is desired, the output signal is passed through a low-pass filter, which removes the high frequency spectral components, and outputs the desired direct-voltage (or DC) level, plus some ripple at the pulse frequency. In many applications, such as when the voltage produces thermal effects, there is no need for a low-pass filter, since the process, or physical effect, itself has an inherent long time constant, thus behaving like a low-pass filter. In the sequel, any such effect will be understood to come under both the general terms xe2x80x9clow-pass filterxe2x80x9d and xe2x80x9clow-pass processxe2x80x9d. It will also be understood that any low-pass process has a generally decreasing spectral characteristic, that isxe2x80x94its attenuation is generally increasing with frequency. It is noted that the resolution with which the level is controlled is akin to the resolution (or quantum size) with which the pulse width is determined. The latter is clearly equal to the ratio of a is period of the width-modulated pulses to a clock period, which is 1/N=1/2{circumflex over ( n)}.
A typical distribution of amplitude vs. frequency for a typical PWM pulse train of prior art, before and after a low-pass filter, is presented, respectively, in the logarithmically-scaled spectral graphs of FIGS. 2A and 2B. FIG. 2B also shows a typical attenuation graph of the filter. The relevant parameters in this example are: Clock-frequency (C)=50 MHz, n=14 and V=1639, whereby the pulse rate is C/N=3 KHz. It is readily seen that the first few harmonics, which are the primary contributors to the ripple, are attenuated by only a little. For a given low-pass filter, the ripple can be reduced by increasing the pulse rate. The latter can, in turn, be achieved either by decreasing the number of control bits, n, or by increasing the clock frequency. Clearly, decreasing n reduces the resolution of level control, whereas increasing the clock frequency requires more complex or expensive circuitry, or may not even be feasible in a given system or under certain circumstances.
There is therefore a clear need for, and it would be advantageous to have, a method for digitally generating pulses that, when applied to a given low-pass filter, result in direct voltage with reduced ripple power, yet whose level is controllable at high resolution.
It is noted that in some current applications the frequency of the pulses is sometimes varied for reasons other than that discussed above. A notable reason is the desire to avoid radio-frequency interference (RFI) from. the circuits. In U.S. Pat. No. 6,204,649 to Roman, for example, there is disclosed a PWM controller which incorporates a varying frequency oscillator, causing the frequency of a switching regulator to vary, thus spreading out the EMI noise generated by it. Also in U.S. Pat. No. 5,537,305 to Colotti there is disclosed a switching power supply, whose switching frequency is varied so as to avoid interference. In all such and other cases, however, the frequency is typically shifted by a relatively small amount, which would be insignificant for ripple reduction; moreover, even when there is a considerable frequency shift, there is no attempt to retain the resolution of the level control.
Dynamic control of the voltage level means that the control number itself varies with time, requiring also the controlled direct voltage level to vary accordingly. As long as this variation is substantially slower than the pulse rate and is well within the pass band of the low-pass filter, the method discussed above is valid, whereby any average of the pulse train is computed over a period equal to a sufficient number of pulse periods, yet short enough for any variation of the control value to be insignificant.
In many cases, the application calls for a plurality of voltage levels to be independently controlled. In prior art systems, this is achieved by simple repetition of the relevant circuits, which may prove to be unduly expensive.
It is the object of the present invention to provide a method for reducing ripple in a digitally controlled direct voltage level output by a given low-pass filter operating on a train of width-modulated pulses, without reducing resolution, and without requiring a higher clock frequency.
The basic principle underlying the method of the invention is to generate the pulses at a rate R that is much higher than that proscribed by the clock frequency and the length, n, of the control number (as explained above). The rate R is chosen to be equal to, or higher than, the lowest frequency for which the filter""s attenuation, is greater than a desired value. The width of the pulses is modulated so that, on the average, it is exactly proportional to the control number, while the width of individual pulses varies cyclically. Preferably the pulse widths are selected from two valuesxe2x80x94wide and narrow, differing by one clock period, wide pulses being preferably interleaved with narrow pulses. The ratio of wider pulses to the total number of pulses in a cycle is proportional, to the difference between the exact desired level and the level that would be attained if all the pulses were narrow.
Specifically, according to one configuration of the invention, the pulse rate R is chosen to be some integral multiple, G, of the prior-art pulse rate C/N; that is R=G*C/N. The given control value, V, is divided by G, resulting in an integral dividend P and a remainder S. A train of pulses is first generated at rate R, the width of the pulses being exactly proportional to P. These pulses are then modified as follows: The train is logically grouped into successive cycles of G consecutive pulses each. Within each cycle, a certain quantity of pulses is selected, in proportion to the value S and each selected pulse is widened by one clock period. Preferably the selected pulses are distributed evenly over the group so as to minimize low frequency components. Clearly, the average level of the resulting pulses, averaged over a cycle, will be proportional to G*P+S, which is equal to V.
Since the control value, V is usually given as an n-bits binary number, the pulse rate multiplier, G, is preferably chosen to be equal to 2{circumflex over ( )}s, s being an integer. The division of V by G then amounts to evaluating the s low-order bits of V as representing S and the p=nxe2x88x92s high-order bits of Vxe2x80x94as representing P.
It is noted that a group of G pulses occupies a period of N(=2{circumflex over ( )}n) clock periods, which is also the pulse period in a conventional PWM system. The important difference is that, while in the conventional system this period is occupied by a single pulse and thus determines the main frequency component of the pulse train, a cycle of the pulse train produced according to the invented method consists of a large number, G, of pulses and thus, in generalxe2x80x94has spectral components of much higher frequencies. Thus, for a given clock frequency, C, and a given resolution, N, of the level control number, the basic pulse rate is increased from C/N, in the conventional method, to G*C/N, thus becoming much more attenuated by any given low-pass filter. There are some remanent frequency components at the original, low pulse rate and its harmonics (due to the necessarily imperfect distribution of wide and narrow pulses), but their amplitude is relatively very low.
An extreme choice of parameters is p=0 and s=n; thus G=N. In this case, all narrow pulses have zero width and the width of a wide pulse is one clock period. The number of non-zero pulses in a cycle will then be proportional to the value of the control number and the basic pulse rate may reach half of C. Clearly, in this case the pulse train will have strong spectral components at very high frequencies, which will therefore be maximally attenuated.
Apparatus embodying the method of the invention is also disclosed. In a preferred embodiment it consists of a width-modulating pulse generator, producing a train of pulses whose width is proportional to P, and a pulse width modifier, which increases the width of S pulses within each cycle by one clock period.
More specifically, the invention, applicable to a control system, is of a method for generating a train of pulses whose mean level is proportional to a given number V, having N equispaced possible values, the pulses to be applied to a given low-pass process, there being defined for the system a clock rate C, the method comprising:
(a) determining a frequency F, above which the relative attenuation of the low-pass process is greater than, a given value,
(b) generating a train of constant-amplitude pulses at a rate R equal to or greater than F, the width of each pulse being an integer multiple of a clock period, 1/C, and the widths of all pulses being not necessarily equal, and
(c) logically dividing the train of pulses into successive cycles;
wherein the average width of pulses over each cycle is proportional to V and wherein R may be greater than C/N.
According to further features of the invented method, the duration of each cycle is that of N clock periods and any pulse has one of two width values, wide and narrow, differing by one clock period, wide and narrow pulses being optimally interleaved, namely as evenly distributed as possible, so that the amplitude of any resulting frequency component below R is minimized.
In a particular configuration the method further comprises:
(d) dividing V by G=N*R/C, resulting in an integral dividend P and a remainder S;
and the width of each narrow pulse is P clock periods and the number of wide pulses in each cycle is S.
According to further features of this configuration, N=2 exp(n) (2 to the power n), n being an integer, and V is represented by a binary number with n bits; and the dividing in step d includes grouping the binary representation of V into p high-order bits and s low-order bits, where p=log 2(N/G) and s=nxe2x88x92p, the p high-order bits representing a value P and the s low-order bits representing a value S.
According to other features of the invented method, the generating in step b includes:
(i) generating a train of primary pulses, all of them being either narrow or wide;
(ii) selecting pulses within each cycle; and
(iii) changing the width of each of the selected pulses.
According to an alternative configuration of the invented method, the generating in step b includes:
(iv) generating two synchronous pulse trains, a first train being of narrow pulses, and a second train being of wide pulses;
(v) selectively switching pulses from the two trains into a common output path so that over each cycle there will be output exactly S wide pulses.
According to another alternative configuration of the invented method, step d is executed once for each possible value of V over one cycle, the resultant patterns of pulses are stored and the generating in step b includes periodically reading out a pattern of pulses corresponding to the given number V.
In another particular configuration, R=C and the width of each pulse is selected from the values zero and one clock period.
According to an alternative aspect of the latter configuration, the method of the invention comprises:
(a) logically defining successive time cycles, each being N clock periods long, and logically dividing each cycle into N equal time slots;
(b) For each cycle, assigning to each time slot a value selected from zero and a given pulse amplitude.
wherein the assigning is such that the mean value of all time slots over the respective cycle is proportional to V and that no two adjacent time slots are assigned the pulse amplitude value if V is equal to or less than half its maximum possible value, and no two adjacent time slots are assigned zero value, if V is greater than half its maximum possible value.
According to another aspect of the invention, as applicable to a control system, there is provided a pulse generator for generating a train of control pulses whose mean level is proportional to a given number V, having N equispaced possible values, the pulses to be applied to a given low-pass process, there being provided by the system a train of clock pulses, at a rate C and with a period 1/C, the pulse generator comprising:
a controlled-width pulse generator (CWPG), operative to generate a train of primary pulses at constant amplitude, constant rate R and constant width, the rate being equal to or greater than the frequency at which the relative attenuation of the low-pass process becomes greater than a given value, and the width being an integral multiple of the clock period; and
a pulse width modifier, operative to select primary pulses output by the CWPG and to modify the width of the selected pulses by an integral multiple of the clock period, its output being the train of control pulses;
whereby the constant width, the selecting and the modifying are such that the average pulse width over each successive cycle of control pulses is proportional to V and whereby R may be greater than C/N.
According to further features of the invention, the modifier includes:
a secondary pulse generator, operative to generate a secondary pulse for each selected primary pulse, the width of each secondary pulse being essentially equal to the respective modification; and
a combiner, operative to combine the secondary pulses with corresponding ones of the selected primary pulses.
According to an alternative configuration of the invention, the pulse generator comprises:
a plurality of controlled-width pulse generators, each operative to generate a train of primary pulses at a common constant amplitude, a common constant rate R, greater than C/N, and constant width, the pulse widths of the several trains being mutually different; and
a switch, operative to select for each pulse period one of said generated trains and to feed said selected train to a common output terminal.
According to another alternative configuration of the invention, the pulse generator comprises:
a lookup table, having N entriesxe2x80x94one for each possible value of V, there being stored at each entry a pattern of a plurality of pulses, the pattern having a length of N clock pulses, the pulses being of various widths and the mean level of each pattern being proportional to the corresponding value of V; and
an addressor, operative, for each successive period of N clock pulses, to address said lookup table according to the given number V and to cause the corresponding stored pattern to be read out therefrom so as to become a train of control pulses.